/*     */ package com.lmpop.trade.ti_subscribe;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import com.lmpop.trade.ti_user.Ti_userInfo;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_subscribeInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_subscribeInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  26 */     RandomID randId = new RandomID();
/*  27 */     String info_id = randId.GenTradeId();
/*     */ 
/*  29 */     Ti_subscribe ti_subscribe = new Ti_subscribe();
/*  30 */     ti_subscribe.setInfo_id(info_id);
/*  31 */     ti_subscribe.setUser_id(map.getString("session_user_id"));
/*  32 */     Ti_userInfo ti_userinfo = new Ti_userInfo();
/*  33 */     List list = ti_userinfo.getListByPk(map.getString("session_user_id"));
/*  34 */     String cust_id = "";
/*  35 */     Hashtable p_map = new Hashtable();
/*  36 */     if ((list != null) && (list.size() > 0)) {
/*  37 */       p_map = (Hashtable)list.get(0);
/*  38 */       if (p_map.get("cust_id") != null)
/*  39 */         cust_id = p_map.get("cust_id").toString();
/*     */     }
/*  41 */     ti_subscribe.setCust_id(cust_id);
/*  42 */     ti_subscribe.setInfo_type(map.getString("info_type"));
/*  43 */     ti_subscribe.setKeyword(map.getString("keyword"));
/*  44 */     ti_subscribe.setCat_id_group(map.getString("cat_id_group"));
/*  45 */     ti_subscribe.setCh_id_group(map.getString("ch_id_group"));
/*  46 */     ti_subscribe.setInfo_num(map.getInt("info_num"));
/*  47 */     ti_subscribe.setSend_type(map.getString("send_type"));
/*  48 */     ti_subscribe.setEnabled(map.getString("enabled"));
/*     */ 
/*  50 */     String result_code = "0";
/*     */     try {
/*  52 */       insert(dbmMgr, ti_subscribe);
/*     */     } catch (ApplicationException e) {
/*  54 */       e.printStackTrace();
/*  55 */       result_code = "1";
/*     */     }
/*  57 */     map.setString("result_code", result_code);
/*  58 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_subscribe ti_subscribe)
/*     */     throws ApplicationException
/*     */   {
/*  67 */     dbmMgr.update("insertTi_subscribe", ti_subscribe);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  77 */     String pkid_string = map.getString("pkid");
/*  78 */     String result_code = "0";
/*     */     try {
/*  80 */       if (!pkid_string.equals("")) {
/*  81 */         String[] pkStr = pkid_string.split("\\|");
/*  82 */         for (int i = 0; i < pkStr.length; i++) {
/*  83 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  87 */       e.printStackTrace();
/*  88 */       result_code = "1";
/*     */     }
/*  90 */     map.setString("result_code", result_code);
/*  91 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 100 */     dbmMgr.update("deleteTi_subscribe", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 110 */     Ti_subscribe ti_subscribe = new Ti_subscribe();
/* 111 */     ti_subscribe.setInfo_id(map.getString("info_id"));
/* 112 */     ti_subscribe.setUser_id(map.getString("session_user_id"));
/* 113 */     ti_subscribe.setCust_id(map.getString("cust_id"));
/* 114 */     ti_subscribe.setInfo_type(map.getString("info_type"));
/* 115 */     ti_subscribe.setKeyword(map.getString("keyword"));
/* 116 */     ti_subscribe.setCat_id_group(map.getString("cat_id_group"));
/* 117 */     ti_subscribe.setCh_id_group(map.getString("ch_id_group"));
/* 118 */     ti_subscribe.setInfo_num(map.getInt("info_num"));
/* 119 */     ti_subscribe.setSend_type(map.getString("send_type"));
/* 120 */     ti_subscribe.setEnabled(map.getString("enabled"));
/* 121 */     String result_code = "0";
/*     */     try {
/* 123 */       update(dbmMgr, ti_subscribe);
/*     */     } catch (ApplicationException e) {
/* 125 */       e.printStackTrace();
/* 126 */       result_code = "1";
/*     */     }
/* 128 */     map.setString("result_code", result_code);
/* 129 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_subscribe ti_subscribe)
/*     */     throws ApplicationException
/*     */   {
/* 138 */     dbmMgr.update("updateTi_subscribe", ti_subscribe);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 149 */     Map params = (Hashtable)obj;
/* 150 */     if (start == 0)
/* 151 */       start = 0;
/*     */     else {
/* 153 */       start = (start - 1) * limit;
/*     */     }
/* 155 */     params.put("start", Integer.valueOf(start));
/* 156 */     params.put("limit", Integer.valueOf(limit));
/*     */ 
/* 158 */     return this.queryList.getList("getListByTi_subscribePage", params);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj) {
/* 162 */     Map params = (Hashtable)obj;
/* 163 */     return this.queryList.getList("getListByTi_subscribePage", params);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 173 */     Map params = (Hashtable)obj;
/* 174 */     List list = this.queryList.getList("getCountByObjTi_subscribe", params);
/* 175 */     int count = 0;
/* 176 */     if ((list != null) && (list.size() > 0)) {
/* 177 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 178 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 179 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 182 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 192 */     return this.queryList.getList("getTi_subscribeByPk", pk);
/*     */   }
/*     */ 
/*     */   public int getIntByKeywrod(String key) {
/* 196 */     int init = 0;
/* 197 */     List list = this.queryList.getList("getIntByKeywrod", key);
/* 198 */     if ((list != null) && (list.size() > 0)) {
/* 199 */       Hashtable map = (Hashtable)list.get(0);
/* 200 */       if ((map.get("info_id") != null) && (!map.get("info_id").toString().equals(""))) {
/* 201 */         init = 1;
/*     */       }
/*     */     }
/* 204 */     return init;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_subscribe.Ti_subscribeInfo
 * JD-Core Version:    0.6.0
 */